﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using GeckoPhotos.Models;
using System.Data.Objects;

namespace GeckoPhotos.Repository
{

    public class EFImageRepository : EFRepositoryBase<int, Image>, IImageRepository
    {
        
        public EFImageRepository()
            : this(new DatabaseEntities())
        {
        }

        public EFImageRepository(DatabaseEntities context)
            : base(context.Images)
        {
        }

        Image IImageRepository.SingleWithMessages(int imageId)
        {
            return _objectSet
                .Include("ImageMessages")
                .Include("ImageMessages.Message")
                .Where(i => i.ImageID == imageId)
                .Single();
        }

   }
}